<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.example.simpleforum.model.Forum" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
    <title>板块管理 - 极简论坛</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
    <h1>板块管理</h1>
    <div class="actions">
        <a href="index.jsp" class="btn">返回首页</a>
    </div>
    
    <div class="forum-list">
        <% 
            List<Forum> forums = (List<Forum>) request.getAttribute("forums");
            if (forums != null && !forums.isEmpty()) {
                for (Forum forum : forums) {
        %>
        <div class="forum-item">
            <h3><%= forum.getName() %></h3>
            <p><%= forum.getDescription() %></p>
            <div class="forum-actions">
                <a href="ForumDeleteServlet?id=<%= forum.getId() %>" class="btn" 
                   onclick="return confirm('确定要删除这个板块吗？删除后将无法恢复！')">删除板块</a>
            </div>
        </div>
        <% 
                }
            } else {
        %>
        <p>暂无板块</p>
        <% } %>
    </div>
</div>
</body>
</html>